package com.zhibang.controller;

import com.zhibang.config.websocket.WebSocketServer;
import com.zhibang.util.Result;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @autor l
 * @date 2025年06月27日14:37
 */
@RestController
@Tag(name = "演示消息推送")
public class SocketController {
@Resource
WebSocketServer webSocketServer;

@RequestMapping("send")
    public Result send(String uid, String message){
    try {
        webSocketServer.sendOneMessage(uid,message);
        return Result.ok("发送成功");
    } catch (Exception e) {
        return Result.fail("发送失败");
    }
}
}
